I have organised my data in 2 formal modules. |
Re: DXL Script to select/unselect requirements for a project based on top level
A DOORS way to go about this would be to link the Features to the Projects (using a module for each) and then link the requirements to the features. Then you can get the information about the project over the links. For this you would use a DXL attribute, which could look like this:
Link L
string s = ""
for L in obj->"*" do {
ModuleVersion mv = targetVersion L
m = data mv
// if the target module is not open yet, open it invisibly ...
if (null m) m = load (mv, false)
// silently skip this link if we cannot read the target module
if (null m) continue
// check if we are at the right target module
if (name m != "My Feature Module") continue
// get the link target
Object tgt = target L
// silently skip the link if the link goes to a deleted object
if (!null tgt && !isDelted tgt) {
bool inPrjA = tgt."ProjectA"
bool inPrjB = tgt."ProjectB"
if (inPrjA) s = "Project A"
if (inPrjB) s = s (s == "" ? "" : "\n") "Project B"
}
}
obj.attrDXLName = s
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: DXL Script to select/unselect requirements for a project based on top level Mathias Mamsch - Tue May 11 13:44:51 EDT 2010
A DOORS way to go about this would be to link the Features to the Projects (using a module for each) and then link the requirements to the features. Then you can get the information about the project over the links. For this you would use a DXL attribute, which could look like this:
Link L
string s = ""
for L in obj->"*" do {
ModuleVersion mv = targetVersion L
m = data mv
// if the target module is not open yet, open it invisibly ...
if (null m) m = load (mv, false)
// silently skip this link if we cannot read the target module
if (null m) continue
// check if we are at the right target module
if (name m != "My Feature Module") continue
// get the link target
Object tgt = target L
// silently skip the link if the link goes to a deleted object
if (!null tgt && !isDelted tgt) {
bool inPrjA = tgt."ProjectA"
bool inPrjB = tgt."ProjectB"
if (inPrjA) s = "Project A"
if (inPrjB) s = s (s == "" ? "" : "\n") "Project B"
}
}
obj.attrDXLName = s
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
Module Features has the following ID-Feature-FeatureDiversity-ProjectA-ProjectB-ProjectC 1-Feature1-Feature_Div1-True-False-True 2-Feature2-Feature_Div2-False-True-True 3-Feature3-Feature_Div3-False-True-True Module Requirements has the following ID-Requirement-FeatureDiversity-ProjectUsed(multi value Enum) 1-Requirement1-Feature_Div1- <Assigned by script to ProjectA,ProjectC> 2-Requirement2-Feature_Div1- <Assigned by script to ProjectA,ProjectC> 3-Requirement3-Feature_Div2- <Assigned by script to ProjectB,ProjectC> 4-Requirement4-Feature_Div3- <Assigned by script to ProjectB, ProjectC> Do I need to create links first and then assign the ProjectUsed attribute using the script or all this can be done by the script. |
Re: DXL Script to select/unselect requirements for a project based on top level SystemAdmin - Tue May 11 22:23:31 EDT 2010
If you use no links the code gets a little easier, but also a little slower, since you need to search the feature module for the feature diversity you are looking for. Regards, Mathias
string s = ""
string sObjDiversity = obj."FeatureDiversity"
Module m = read("Features", false)
Object tgt
for tgt in m do {
if (isDeleted tgt) continue
if (tgt."FeatureDiversity" "" == sObjDiversity) {
bool inPrjA = tgt."ProjectA"
bool inPrjB = tgt."ProjectB"
bool inPrjC = tgt."ProjectC"
if (inPrjA) s = "Project A"
if (inPrjB) s = s (s == "" ? "" : "\n") "Project B"
if (inPrjC) s = s (s == "" ? "" : "\n") "Project C"
break
}
}
obj.attrDXLName = s
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: DXL Script to select/unselect requirements for a project based on top level Mathias Mamsch - Wed May 12 11:46:03 EDT 2010
If you use no links the code gets a little easier, but also a little slower, since you need to search the feature module for the feature diversity you are looking for. Regards, Mathias
string s = ""
string sObjDiversity = obj."FeatureDiversity"
Module m = read("Features", false)
Object tgt
for tgt in m do {
if (isDeleted tgt) continue
if (tgt."FeatureDiversity" "" == sObjDiversity) {
bool inPrjA = tgt."ProjectA"
bool inPrjB = tgt."ProjectB"
bool inPrjC = tgt."ProjectC"
if (inPrjA) s = "Project A"
if (inPrjB) s = s (s == "" ? "" : "\n") "Project B"
if (inPrjC) s = s (s == "" ? "" : "\n") "Project C"
break
}
}
obj.attrDXLName = s
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
What is the purpose of this statement: obj.attrDXLName = s I want to assign the s value to ProjectUsed atribute wihich is a multi value enum type. This is how my code looks now: string s = "" Module currModule = current Module Object obj = null for obj in currModule do { if (obj."Object Text" "" == "") break string sObjDiversity = obj."FeatureDiversity" Module m = read("Features", false) Object tgt for tgt in m do { if (isDeleted tgt) continue if (tgt."FeatureDiversity" "" == sObjDiversity) { bool inPrjA = tgt."ProjectA" bool inPrjB = tgt."ProjectB" bool inPrjC = tgt."ProjectC" if (inPrjA) s = "Project A" if (inPrjB) s = s (s == "" ? "" : "\n") "Project B" if (inPrjC) s = s (s == "" ? "" : "\n") "Project C" break } } obj.attrDXLName = s } |
Re: DXL Script to select/unselect requirements for a project based on top level SystemAdmin - Wed May 12 23:33:30 EDT 2010 If you just want to fill a normal attribute with the projects (e.g. to edit them afterwards) you can replace the obj.attrDXLName = s by obj."ProjectUsed" = s and as you already did put a loop for obj in current module do around the code. Regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: DXL Script to select/unselect requirements for a project based on top level Mathias Mamsch - Thu May 13 07:51:40 EDT 2010 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |